<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('历史任务列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>code：</label>
                                <input type="text" name="procCode"/>
                            </li>
                            <li>
                                <label>任务结果：</label>
                                <select name="taskResult" th:with="type=${@dict.getType('ding_task_result')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>


                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var getTaskedDetail = [[${@permission.hasPermi('ding:task:getTaskedDetail')}]];
        var prefix = "/ding/task";
        var dingTaskResult = [[${@dict.getType('ding_task_result')}]];
        $(function() {
            var options = {
                url: prefix + "/getMyTaskedList",
                modalName: "我的已办",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '',
                    visible: false
                },
                {
                    field: 'sysDingProcinst.title',
                    title: '流程名称'
                },
                {
                    field: 'sysDingProcinst.startUserName',
                    title: '流程发起人'
                },

                {
                    field: 'sysDingProcinst.startTime',
                    title: '流程发起时间'
                },
                {
                    field: 'taskResult',
                    title: '任务结果',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(dingTaskResult, value);
                    }
                },

                {
                    field: 'createTime',
                    title: '任务创建时间'
                },

                {
                    field: 'finishTime',
                    title: '任务结束时间'
                },
                    {
                        field: 'taskSpendTime',
                        title: '任务历时'
                    },

                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + getTaskedDetail + '" href="javascript:void(0)" onclick="taskedDetail(\''+row.id+'\')"><i class="fa fa-eye"></i>详情</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);


        });

        function taskedDetail(taskId) {
            var preViewUrl=prefix+'/getTaskedDetail?taskId='+taskId;
            $.modal.openTab("详情", preViewUrl);
        }
    </script>
</body>
</html>